-- 随机数
local num = math.random()
print(num)
local num_2 = math.random(8)
print(num_2)
local num_3 = math.randomseed(os.time())
print(num_3)

-- 取整
local num_4 = math.ceil(1.5)
print(num_4)
local num_5 = math.floor(1.5)
print(num_5)
local num_6 = math.modf(3.3)
print(num_6)
local x = 2 ^ 52 + 1
print(string.format("%d %d",x,math.floor(x + 0.5)))

function round(num)
    local f = math.floor(num)
    if num - f < 0.5 and num > 0 then
        return f
    end
    return f + 1
end
local y = round(1.3)
local z = round(1.5)
print(string.format("y:%d,z:%d",y,z))
print(round(-2.5))
print(round(-2.4))